<!-- 管理员-学生信息列表 -->
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>学生成绩管理系统</title>
    <link rel="icon" type="image/png" href="/assets/img/学籍管理.svg">
    <link href="asserts/css/bootstrap.min.css" th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.css}" rel="stylesheet">
    <link href="/assets/css/dashboard.css"  rel="stylesheet">
    <style type="text/css">
        @-webkit-keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }
        @keyframes chartjs-render-animation {
            from {
                opacity: 0.99
            }
            to {
                opacity: 1
            }
        }
        .chartjs-render-monitor {
            -webkit-animation: chartjs-render-animation 0.001s;
            animation: chartjs-render-animation 0.001s;
        }
    </style>
</head>

<body>
<!--引入抽取的topbar-->
<!--模板名：会使用thymeleaf的前后缀配置规则进行解析-->
<div th:replace="bar/admbar::topbar"></div>
<div class="container-fluid">
    <div class="row" >
        <!--引入侧边栏-->
        <div th:replace="bar/admbar::#sidebar(activeUri='stu')" style="padding-top: 0px!important;"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2>
                <a class="btn btn-info" href="emp" th:href="@{/adm/stuadd}" style="background-color: #B19FFF;border-color: #c8c8f8">新增学生</a>
                <a style="float: right;background-color: #80bdff;border-color: #b8daff" class="btn btn-outline-secondary" href="" th:href="@{/adm/tostudmin/1}">返回初始学生信息总览页面</a>
            </h2>
            <div class="container" style="margin-top: 30px;margin-bottom: 20px;margin-left: 30px;margin-right: 30px">
                <div class="row">
                    <div class="col">
                        <form method="get" th:action="@{/adm/selectById}">
                            <div class="input-group mb-3" style="width: 350px">
                                <input type="text" class="form-control" name="stuId" placeholder="请输入学号" aria-label="请输入学号" aria-describedby="button-addon2">
                                <div class="input-group-append">
                                    <button class="btn btn-outline-secondary" type="submit" id="button-addon2">查询</button>
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="col">
                        <form method="get" th:action="@{/adm/selectByClass/1}">
                            <div class="form-group d-flex align-items-center" style="width: 370px">
                                <select class="form-control" name="className">
                                    <option value="">请下拉列表选择班级</option>
                                    <option th:each="class : ${classes}"
                                            th:value="${class.className}"
                                            th:text="${class.className}"
                                            th:selected="${class.className == className}"></option>
                                </select>
                                <button style="margin-left: 10px; width: 100px;" type="submit" class="btn btn-outline-secondary">查询</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            <div class="table-responsive">
                <table class="table table-striped table-sm" style="text-align: center;width: 800px;margin-left: 110px">
                    <thead>
                    <tr style="color: #007bff;">
                        <th>学号</th>
                        <th>班级</th>
                        <th>姓名</th>
                        <th>性别</th>
                        <th>电话</th>
                        <th>密码</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr th:each="stu:${pageInfo.list}" th:if="stu!=null" >
                        <td th:text="${stu.stuId}"></td>
                        <td th:text="${stu.stuClass}"></td>
                        <td th:text="${stu.stuName}"></td>
                        <td th:text="${stu.stuSex}==0?'女':'男'"></td>
                        <td th:text="${stu.stuTele}"></td>
                        <td th:text="${stu.stuPass}"></td>
                        <td>
                            <a class="btn btn-sm btn-primary" th:href="@{/adm/stu/}+${stu.stuId}" style="background-color: #80bdff;border-color: #b8daff">编辑</a>
                            <button th:attr="del_uri=@{/adm/stu/}+${stu.stuId}" class="btn btn-sm btn-danger deleteBtn" style="margin-left:10px;background-color: #B19FFF;border-color: #c8c8f8">删除</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </div>

            <!--分页信息-->
            <nav aria-label="Page navigation example" >
                <ul class="pagination justify-content-center"  >
                    <li class="page-item"><a class="page-link" href="#" th:href="@{/adm/tostudmin/1}" th:style="'font-weight:bold;background: #b8daff;'">首页</a></li>
                    <li class="page-item" th:classappend="${pageInfo.hasPreviousPage}?'':' disabled'">
                        <a class="page-link" href="#" th:href="@{/adm/tostudmin/}+${pageInfo.pageNum-1}" tabindex="-1" aria-disabled="true"><svg t="1719552400272" class="icon" viewBox="0 0 1137 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2171" width="16" height="16"><path d="M534.721393 18.805127a93.519358 93.519358 0 0 1 56.885254-18.772134 99.890507 99.890507 0 0 1 102.393459 97.273786v97.842638a49.14886 49.14886 0 0 0 45.508203 48.921318h301.491849A98.240835 98.240835 0 0 1 1137.705091 341.344521v341.311527a98.240835 98.240835 0 0 1-96.704933 97.273785H739.508309a49.14886 49.14886 0 0 0-45.508203 48.921319v97.842638A99.890507 99.890507 0 0 1 591.606647 1023.967575a93.519358 93.519358 0 0 1-56.885254-18.772134L34.131153 598.465871a126.569691 126.569691 0 0 1 0-172.931173z" fill="#b8daff" p-id="2172"></path></svg></a>
                    </li>

                    <li class="page-item"  th:each="page_Num:${pageInfo.navigatepageNums}" >
                        <a class="page-link"  th:text="${page_Num}" th:href="@{/adm/tostudmin/}+${page_Num}"  th:if="${page_Num}==${pageInfo.pageNum}" th:style="'font-weight:bold;background: #b8daff;'">1</a>
                        <a class="page-link"  th:text="${page_Num}" th:href="@{/adm/tostudmin/}+${page_Num}"  th:if="${page_Num}!=${pageInfo.pageNum}" >1</a>
                    </li>

                    <li class="page-item" th:classappend="${pageInfo.hasNextPage}?'':' disabled'">
                        <a class="page-link" href="#" th:href="@{/adm/tostudmin/}+${pageInfo.pageNum+1}"><svg t="1719552659907" class="icon" viewBox="0 0 1137 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2558" width="16" height="16"><path d="M602.983698 18.805127a93.519358 93.519358 0 0 0-56.885254-18.772134 99.890507 99.890507 0 0 0-102.393458 97.273786v97.842638a49.14886 49.14886 0 0 1-45.508204 48.921318H96.704933A98.240835 98.240835 0 0 0 0 341.344521v341.311527a98.240835 98.240835 0 0 0 96.704933 97.273785H398.196782a49.14886 49.14886 0 0 1 45.508204 48.921319v97.842638A99.890507 99.890507 0 0 0 546.098444 1023.967575a93.519358 93.519358 0 0 0 56.885254-18.772134l500.59024-406.72957a126.569691 126.569691 0 0 0 0-172.931173z" fill="#b8daff" p-id="2559"></path></svg></a>
                    </li>
                    <li class="page-item"><a class="page-link" href="#" th:href="@{/adm/tostudmin/}+${pageInfo.pages}" th:style="'font-weight:bold;background: #b8daff;'">尾页</a></li>
                </ul>
            </nav>

        </main>
        <form id="deleteEmpForm"  method="post">
            <input type="hidden" name="_method" value="delete"/>
        </form>
    </div>
</div>

<script type="text/javascript" src="asserts/js/jquery-3.2.1.slim.min.js" th:src="@{/webjars/jquery/3.3.1/jquery.js}"></script>
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script type="text/javascript" src="asserts/js/bootstrap.min.js" th:src="@{/webjars/bootstrap/4.0.0/js/bootstrap.js}"></script>

<!-- Icons -->
<script type="text/javascript" src="asserts/js/feather.min.js" th:src="@{/asserts/js/feather.min.js}"></script>
<script>
    feather.replace()
</script>
<script>
    $(".deleteBtn").click(function(){
        //删除当前员工的
        var i=confirm("你确定要删除吗?");
        if(i==true)
        {
            $("#deleteEmpForm").attr("action",$(this).attr("del_uri")).submit();
            return false;
        }
        else {
            return false;
        }

    });
</script>
</body>
</html>